package com.javaweb.controller;

import com.javaweb.Response.ResponseResult;
import com.javaweb.model.Category;
import com.javaweb.model.Tag;
import com.javaweb.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/blog-api/v0.1/tag")
public class TagController {
    @Autowired
    private TagService tagService;
    @PostMapping("/add")
    public ResponseResult<Object> add(Tag tag){
        tagService.add(tag);
        return ResponseResult.ok(null,"新增成功");
    }
    @DeleteMapping("/delete")
    public ResponseResult<Object> delete(Tag tag){
        tagService.add(tag);
        return ResponseResult.ok(null,"删除成功");
    }
    @GetMapping("/list")
    public ResponseResult<List<Tag>> list(){
        return ResponseResult.ok(tagService.list(),"查询所有成功");
    }
}
